using System;
using System.Collections.Generic;

using EntModApp.EntServices.Data;

namespace DemoApp.DataAccess 
{
  public static class FavoritePropertyNames
  {
    public const string Vote = @"Vote"; 

  }

  public static class FavoriteReferenceNames
  {
    public const string User = @"User"; 

    public const string Subject = @"Subject"; 

    public const string SuperFavorites = @"SuperFavorites"; 

  }

  [Serializable]
  public partial class FavoriteLoadSettings 
  {

    public FavoriteLoadSettings()
    {
      AsReadonly = false;

      OnCreate();
    }

    public bool AsReadonly { get; set; }

    private FavoriteFilterExpression filter;
    public FavoriteFilterExpression Filter 
    { 
      get 
      { 
        filter = FavoriteFilterExpression.FromFavoriteFilterExpression(filter);
        return filter; 
      }
      set { filter = value; }
    }

    private FavoriteSelectionSettings selection;
    public FavoriteSelectionSettings Selection 
    { 
      get 
      { 
        selection = FavoriteSelectionSettings.FromFavoriteSelectionSettings(selection);
        return selection; 
      }
      set { selection = value; }
    }

    private FavoriteInclusionSettings inclusion;
    public FavoriteInclusionSettings Inclusion 
    { 
      get 
      { 
        inclusion = FavoriteInclusionSettings.FromFavoriteInclusionSettings(inclusion);
        return inclusion; 
      }
      set { inclusion = value; }
    }

    private FavoriteSortingSettings sorting;
    public FavoriteSortingSettings Sorting 
    { 
      get 
      { 
        sorting = FavoriteSortingSettings.FromFavoriteSortingSettings(sorting);
        return sorting; 
      }
      set { sorting = value; }
    }

    private PagingSettings paging;
    public PagingSettings Paging 
    { 
      get 
      { 
        if (paging == null) paging = new PagingSettings();
        return paging; 
      }
      set { paging = value; }
    }

    partial void OnCreate();

    protected virtual void CopyFrom(FavoriteLoadSettings other)
    {
      if (other != null)
      {
        filter     = other.filter;
        selection  = other.selection;
        sorting    = other.sorting;
        inclusion  = other.inclusion;
        paging     = other.paging;
      }
    }

    public static FavoriteLoadSettings FromFavoriteLoadSettings(FavoriteLoadSettings other)
    {
      if (other != null) return other;
      var result = new FavoriteLoadSettings();
      return result;
    }

  }

  [Serializable]
  public partial class FavoriteFilterExpression 
  {
    public FavoriteKey ByKey { get; set; }

    public int? Skip { get; set; }

    public int? Take { get; set; }

    public SimpleFilterExpression<double?> VoteFilter { get; set; }

    partial void OnCreate();

    protected virtual void CopyFrom(FavoriteFilterExpression other)
    {
      if (other != null)
      {
        ByKey = other.ByKey;
        Skip = other.Skip;
        Take = other.Take;
      }
    }

    public static FavoriteFilterExpression FromFavoriteFilterExpression(FavoriteFilterExpression other)
    {
      if (other != null) return other;
      var result = new FavoriteFilterExpression();
      return result;
    }

  }

  [Serializable]
  public partial class FavoriteSelectionSettings 
  {
    public FavoriteSelectionSettings()
    {
      SelectVote = true;

      OnCreate();
    }

    public bool SelectVote { get; set; } 

    partial void OnCreate();

    protected virtual void CopyFrom(FavoriteSelectionSettings other)
    {
      if (other != null)
      {
        SelectVote = other.SelectVote;
      }
    }

    public static FavoriteSelectionSettings FromFavoriteSelectionSettings(FavoriteSelectionSettings other)
    {
      if (other != null) return other;
      var result = new FavoriteSelectionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class FavoriteInclusionSettings 
  {
    public FavoriteInclusionSettings()
    {
      OnCreate();
    }

    public bool IncludeUser { get; set; }
    private UserLoadSettings includedUserSettings;
    public UserLoadSettings IncludedUserSettings 
    { 
      get
      {
        includedUserSettings = UserLoadSettings.FromUserLoadSettings(includedUserSettings);
        return includedUserSettings;
      } 
      set
      {
        includedUserSettings = value;
      }
    }

    public bool IncludeSubject { get; set; }
    private SubjectLoadSettings includedSubjectSettings;
    public SubjectLoadSettings IncludedSubjectSettings 
    { 
      get
      {
        includedSubjectSettings = SubjectLoadSettings.FromSubjectLoadSettings(includedSubjectSettings);
        return includedSubjectSettings;
      } 
      set
      {
        includedSubjectSettings = value;
      }
    }

    public bool IncludeSuperFavorites { get; set; }
    private FavoriteDerivedLoadSettings includedSuperFavoritesSettings;
    public FavoriteDerivedLoadSettings IncludedSuperFavoritesSettings 
    { 
      get
      {
        includedSuperFavoritesSettings = FavoriteDerivedLoadSettings.FromFavoriteDerivedLoadSettings(includedSuperFavoritesSettings);
        return includedSuperFavoritesSettings;
      } 
      set
      {
        includedSuperFavoritesSettings = value;
      }
    }


    partial void OnCreate();

    protected virtual void CopyFrom(FavoriteInclusionSettings other)
    {
      if (other != null)
      {
        IncludeUser = other.IncludeUser;
        includedUserSettings = other.includedUserSettings;
        IncludeSubject = other.IncludeSubject;
        includedSubjectSettings = other.includedSubjectSettings;
        IncludeSuperFavorites = other.IncludeSuperFavorites;
        includedSuperFavoritesSettings = other.includedSuperFavoritesSettings;
      }
    }

    public static FavoriteInclusionSettings FromFavoriteInclusionSettings(FavoriteInclusionSettings other)
    {
      if (other != null) return other;
      var result = new FavoriteInclusionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class FavoriteSortingSettings 
  {
    public FavoriteSortingSettings()
    {
      OnCreate();
    }


    partial void OnCreate();

    protected virtual void CopyFrom(FavoriteSortingSettings other)
    {
      if (other != null)
      {
      }
    }

    public static FavoriteSortingSettings FromFavoriteSortingSettings(FavoriteSortingSettings other)
    {
      if (other != null) return other;
      var result = new FavoriteSortingSettings();
      return result;
    }

  }
}
